\(\int \cos (c+d x) (a+b \cos (c+d x)) \, dx\) [409]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 38 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {b x}{2}+\frac {a \sin (c+d x)}{d}+\frac {b \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*b*x+a*sin(d*x+c)/d+1/2*b*cos(d*x+c)*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 38, normalized size of antiderivative = 1.00, number of steps used = 1, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.059, Rules used = {2813} \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {a \sin (c+d x)}{d}+\frac {b \sin (c+d x) \cos (c+d x)}{2 d}+\frac {b x}{2} \]

[In]

Int[Cos[c + d*x]*(a + b*Cos[c + d*x]),x]

[Out]

(b*x)/2 + (a*Sin[c + d*x])/d + (b*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 2813

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(2*a*c +
 b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Cos[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /;
 FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {b x}{2}+\frac {a \sin (c+d x)}{d}+\frac {b \cos (c+d x) \sin (c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.07 (sec) , antiderivative size = 35, normalized size of antiderivative = 0.92 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {4 a \sin (c+d x)+b (2 (c+d x)+\sin (2 (c+d x)))}{4 d} \]

[In]

Integrate[Cos[c + d*x]*(a + b*Cos[c + d*x]),x]

[Out]

(4*a*Sin[c + d*x] + b*(2*(c + d*x) + Sin[2*(c + d*x)]))/(4*d)

Maple [A] (verified)

Time = 0.80 (sec) , antiderivative size = 32, normalized size of antiderivative = 0.84

method result size
risch \(\frac {b x}{2}+\frac {a \sin \left (d x +c \right )}{d}+\frac {b \sin \left (2 d x +2 c \right )}{4 d}\) \(32\)
parallelrisch \(\frac {2 b x d +\sin \left (2 d x +2 c \right ) b +4 a \sin \left (d x +c \right )}{4 d}\) \(32\)
derivativedivides \(\frac {b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a \sin \left (d x +c \right )}{d}\) \(38\)
default \(\frac {b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+a \sin \left (d x +c \right )}{d}\) \(38\)
parts \(\frac {b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a \sin \left (d x +c \right )}{d}\) \(40\)
norman \(\frac {b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (2 a -b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (2 a +b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {b x}{2}+\frac {b x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}\) \(91\)

[In]

int(cos(d*x+c)*(a+cos(d*x+c)*b),x,method=_RETURNVERBOSE)

[Out]

1/2*b*x+a*sin(d*x+c)/d+1/4*b/d*sin(2*d*x+2*c)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 29, normalized size of antiderivative = 0.76 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {b d x + {\left (b \cos \left (d x + c\right ) + 2 \, a\right )} \sin \left (d x + c\right )}{2 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*cos(d*x+c)),x, algorithm="fricas")

[Out]

1/2*(b*d*x + (b*cos(d*x + c) + 2*a)*sin(d*x + c))/d

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 66 vs. \(2 (32) = 64\).

Time = 0.09 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.74 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\begin {cases} \frac {a \sin {\left (c + d x \right )}}{d} + \frac {b x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {b x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \cos {\left (c \right )}\right ) \cos {\left (c \right )} & \text {otherwise} \end {cases} \]

[In]

integrate(cos(d*x+c)*(a+b*cos(d*x+c)),x)

[Out]

Piecewise((a*sin(c + d*x)/d + b*x*sin(c + d*x)**2/2 + b*x*cos(c + d*x)**2/2 + b*sin(c + d*x)*cos(c + d*x)/(2*d
), Ne(d, 0)), (x*(a + b*cos(c))*cos(c), True))

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 34, normalized size of antiderivative = 0.89 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {{\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} b + 4 \, a \sin \left (d x + c\right )}{4 \, d} \]

[In]

integrate(cos(d*x+c)*(a+b*cos(d*x+c)),x, algorithm="maxima")

[Out]

1/4*((2*d*x + 2*c + sin(2*d*x + 2*c))*b + 4*a*sin(d*x + c))/d

Giac [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.82 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {1}{2} \, b x + \frac {b \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {a \sin \left (d x + c\right )}{d} \]

[In]

integrate(cos(d*x+c)*(a+b*cos(d*x+c)),x, algorithm="giac")

[Out]

1/2*b*x + 1/4*b*sin(2*d*x + 2*c)/d + a*sin(d*x + c)/d

Mupad [B] (verification not implemented)

Time = 14.37 (sec) , antiderivative size = 31, normalized size of antiderivative = 0.82 \[ \int \cos (c+d x) (a+b \cos (c+d x)) \, dx=\frac {b\,x}{2}+\frac {b\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {a\,\sin \left (c+d\,x\right )}{d} \]

[In]

int(cos(c + d*x)*(a + b*cos(c + d*x)),x)

[Out]

(b*x)/2 + (b*sin(2*c + 2*d*x))/(4*d) + (a*sin(c + d*x))/d